// 合同状态 contractState
// 填写中 0 -> 'FILLING'
// 签署中 1 -> 'SIGNING'
// 已生效 2 -> 'EFFECT'
// 已撤回 3 -> 'WITHDRAWN'
// 已拒签 4 -> 'REFUSED'
// 已失效 5 -> 'EXPIRED'
function contractStateEnum(str) {
  let code = null
  switch (str) {
    case "FILLING":
      code = 0
      break;
    case "SIGNING":
      code = 1
      break;
    case "EFFECT":
      code = 2
      break;
    case "WITHDRAWN":
      code = 3
      break;
    case "REFUSED":
      code = 4
      break;
    case "EXPIRED":
      code = 5
      break;
    default:
      break;
  }
  return code
}


// 发起人类型 promoterType
// 出借人 0 -> CREDITOR_MEMBER
// 借款人 1 -> DEBTOR_MEMBER
function promoterTypeEnum(str) {
  let code = null
  switch (str) {
    case "CREDITOR_MEMBER":
      code = 0
      break;
    case "DEBTOR_MEMBER":
      code = 1
      break;
    default:
      break;
  }
  return code
}

// 合同支付类型 contractPayState
// 未支付 0 -> NOT_PAID
// 已支付 1 -> PAID

function contractPayStateEnum(str) {
  let code = null
  switch (str) {
    case "NOT_PAID":
      code = 0
      break;
    case "PAID":
      code = 1
      break;
    default:
      break;
  }
  return code
}

// 合同付款方式 paymentType
// 阿里支付 0 -> ALIPAY
// 微信支付 1 -> WECHAT_PAT
// 其他 2 -> OTHER

function paymentTypeEnum(str) {
  let code = null
  switch (str) {
    case "ALIPAY":
      code = 0
      break;
    case "OTHER":
      code = 2
      break;
    default:
      code = null
      break;
  }
  return code
}

// 合同转账状态 transferStatus
// 未转账 0 -> NO
// 已转账 1 -> YES
function transferStatusEnum(str) {
  let code = null
  switch (str) {
    case "NO":
      code = 0
      break;
    case "YES":
      code = 1
      break;
    default:
      break;
  }
  return code
}
// 流量包 signPackage  status
// 状态: 1. USED 已使用 / 2. EXPIRED已过期  3. PAID已支付

function signPackageStatusEnum(str) {
  let code = null
  switch (str) {
    case "USED":
      code = 1
      break;
    case "EXPIRED":
      code = 2
      break;
    case "PAID":
      code = 3
      break;
    default:
      break;
  }
  return code
}
export default {
  contractStateEnum,
  promoterTypeEnum,
  contractPayStateEnum,
  paymentTypeEnum,
  transferStatusEnum,
  signPackageStatusEnum
}